package pro.cherish.knowledgedemoioc.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import pro.cherish.knowledgedemoioc.thread.SayThreadHandler;


import java.util.concurrent.*;

/**
 * @author 创建人：cherish
 * @version 版本号：V1.0
 * <p>
 * ***************************修订记录************************************
 * 2019-09-28 cherish 创建该类功能。
 * **********************************************************************
 * </p>
 * @ClassName 类名：Tcontroller
 * @Description 功能说明：
 * <p>
 * TODO
 * </p>
 * **********************************************************************
 * @date 创建日期： 2019-09-28 cherish
 */
@RestController
public class Tcontroller {
    @GetMapping("/t1")
    public void t1(String name, Integer age) throws ExecutionException, InterruptedException {

        System.out.println(name + " " + age);
        //    public ThreadPoolExecutor(int corePoolSize,
        //                               int maximumPoolSize,
        //                               long keepAliveTime,
        //                               TimeUnit unit,
        //                               BlockingQueue<Runnable> workQueue) {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(4,4,200,TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>(), Executors.defaultThreadFactory(),new ThreadPoolExecutor.AbortPolicy() );
        SayThreadHandler threadHandler = new SayThreadHandler("lys");
        Future future = threadPoolExecutor.submit(threadHandler);
        Object result = future.get();
        System.out.println(result);

    }
}
